<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="../common.inc" %>    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="./css/style1.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="./js/form.js"></script>
<script type="text/javascript" language="javascript">
<!--
	function back(){
		var sign = "<c:out value='${sign}'/>";
		var contractId = "<c:out value='${id}'/>";//合同id
		window.location.href = "./contract.do?action=contractDetail&sign="+sign+"&id="+contractId;
		window.location.target = "main";
	}
	
	function addSaleRecord(){
		window.location.href = "addSaleRecord.html";
		window.location.target = "main";
	}
	
	function updateSaleRecord(){
		window.location.href = "updateRecord.html";
		window.location.target = "main";
	}
-->
</script>
</head>
<body>
	<table class="table_frame">
		<tr>
			<td>
				<table class="table_title1">
					<tr>
						<td class="title_lab">
							合同全貌
						</td>
					</tr>
					<tr>
						<td align="center" valign="bottom">
							<button class="btn_back" onclick="back()" hidefocus="true">返回</button>
						</td>
					</tr>
					<tr><td height="2"></td></tr>
				</table>
			</td>
		</tr>
		<tr>
			<td>
				<table class="table_title2">
					<tr>
						<td class="title_lab">
							合同变更记录
						</td>
					</tr>
					<tr>
						<td>
							<table class="table">
								<tr>
									<td valign="top">
										<table class="table_style">
											<tr>
												<td class="title" width="8"></td>
												<td class="title" width="10%">变更记录</td>
												<td class="title">商品名称</td>
												<!-- 
												<td class="title4" width="8%">单位</td>
												<td class="title4" width="10%">单价(元)</td>
												 -->
												<td class="title" width="8%">数量</td>
												<td class="title" width="10%">折扣率(%)</td>
												<td class="title" width="12%">折扣后的金额(元)</td>
												<td class="title" width="10%">成本(元)</td>
												<td class="title" width="10%">毛利(元)</td>
											</tr>
											<%int i = 1; %>
											<c:forEach var="contractDetail" items="${contractDetailUpdateHistorys}" varStatus="cd">
											<tr onmouseover="onmousemoveChange(this,'img${cd.count}')" onmouseout="onmouseoutChange(this,'img${cd.count}')">
												<td height="16" width="8" align="right"><img id="img${cd.count}" src="./images/table_sign2.bmp"></td>
											<c:choose>
												<c:when test="${contractDetail.isPrimitive == 1}">
													<td style="color: red;">原始记录</td>
												</c:when>
												<c:otherwise>
													<td>
														变更记录<%=i%>
														<c:forEach var="contractDetial2" items="${contractDetailUpdateHistorys}" begin="${cd.count - 1}" end="${cd.count}">
															<c:if test="${contractDetail.updateHistoryCode != contractDetial2.updateHistoryCode}">
															<%i ++;%>
															</c:if>
														</c:forEach>
													</td>
												</c:otherwise>
											</c:choose>
												<td align="left">${contractDetail.purchaseDesc}</td>
												<!-- 
												<td>${contractDetail.unit}</td>
												<td>${contractDetail.price}</td>
												 -->
												<td>${contractDetail.num}</td>
												<td>${contractDetail.discount}</td>
												<td>${contractDetail.costValue}</td>
												<td>${contractDetail.costs}</td>
												<td>${contractDetail.prossProfit}</td>
											</tr>
											</c:forEach>
										</table>
									</td>
								</tr>
							</table>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</body>
</html>